home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dr. Windows 3
/
dr win3.zip
/
dr win3
/
PROGRAMR
/
VLIB200.ZIP
/
VISUALIB.H
< prev
next >
Wrap
Text File
|
1993-11-04
|
29KB
|
774 lines
/*****************************************************************************
Visualib Header File
Copyright (c) 1993
Visual Technology International, Co.
P.O.Box 901-413
Kansas City, MO 64190
*****************************************************************************/
/*****************************************************************************
Constants, types, and Macros
*****************************************************************************/
typedef double real;
#define VOIDED void far pascal
#define DOUBLE double far pascal
#define FLOAT float far pascal
#define SHORT short far pascal
#define REAL real far pascal
#define BINARY BOOL far pascal
typedef float huge *hpfloat;
typedef double far *lpdouble;
typedef float far *lpfloat;
typedef real far *lpreal;
typedef real COORD;
typedef COORD COORD2[2];
typedef COORD COORD3[3];
typedef COORD COORD4[4];
typedef COORD far *LPCOORD;
typedef COORD2 far *LPCOORD2;
typedef COORD3 far *LPCOORD3;
typedef COORD4 far *LPCOORD4;
typedef real far *VECTOR;
typedef real far *MATRIX;
typedef real VECTOR2[2];
typedef real VECTOR3[3];
typedef real VECTOR4[4];
typedef real MATRIX2D[9];
typedef real MATRIX3D[16];
typedef VECTOR2 far *LPVECT2;
typedef VECTOR3 far *LPVECT3;
typedef VECTOR4 far *LPVECT4;
typedef VECTOR far *LPVECTOR;
typedef struct _tagPOINT2D { /* 2D point coordinates */
real x, y;
} POINT2D, far *LPPOINT2D;
typedef struct _tagPOINT2H { /* 2D homogeneous point coordinates */
real x, y, w;
} POINT2H, far *LPPOINT2H;
typedef struct _tagPOINT3D { /* 3D point coordinates */
real x, y, z;
} POINT3D, far *LPPOINT3D;
typedef struct _tagPOINT3H { /* 3D homogeneous point coordinates */
real x, y, z, w;
} POINT3H, far *LPPOINT3H;
typedef struct _tagBOX2D {
real xmin, xmax, ymin, ymax;
} BOX2D, far *LPBOX2D;
typedef struct _tagBOX3D {
real xmin, xmax, ymin, ymax, zmin, zmax;
} BOX3D, far *LPBOX3D;
typedef MATRIX3D far *LPMTRX3D;
typedef MATRIX2D far *LPMTRX2D;
#define EPSILON (real) 1e-5
#define QUTRPI (real) 0.78539816
#define HALFPI (real) 1.57079633
#define PI (real) 3.14159265
#define TWOPI (real) 6.2831853
#define DTOR (real) 0.0174532
#define ATOR (real) 1.7453293e-3
#define RTOD (real) 57.295779
#define SQRT2 (real)1.414214
#define SQRT3 (real)1.732051
/* coordinate type */
#define VL_2D 0x1000
#define VL_3D 0x2000
#define VL_2H 0x0400
#define VL_3H 0x0800
/* viewer status flag */
#define VL_TWOD 8
#define VL_THREED 16
#define VL_CURRENT 128
/* light coordinate mode */
#define VL_WORLDLIGHT 0x0001
#define VL_CAMERALIGHT 0x0002
#define VL_OBJECTLIGHT 0x0004
/* light type */
#define VL_POINTLIGHT 0x0100
#define VL_DISTLIGHT 0x0200
#define VL_SPOTLIGHT 0x0400
#define VL_AREALIGHT 0x0800
/* color type */
#define VL_MATERIALAMBIENT 0x0001
#define VL_MATERIALDIFFUSE 0x0002
#define VL_MATERIALSPECULAR 0x0003
#define VL_MATERIALEMISSION 0x0004
#define VL_AMBIENTREFLECT 0x0005
#define VL_DIFFUSEREFLECT 0x0006
#define VL_SPECULARREFLECT 0x0007
#define VL_EMISSIONSTRENGTH 0x0008
#define VL_SHININESS 0x0009
#define VL_LIGHTCOLOR 0x0010
#define VL_AMBIENTCONTRIB 0x0020
#define VL_LIGHTLOCATION 0x0030
#define VL_LIGHTDIRECTION 0x0040
#define VL_LIGHTINTENSITY 0x0050
#define VL_SPOTLIGHTANGLE 0x0060
#define VL_SPOTLIGHTSPREAD 0x0070
#define VL_ATTENUATION 0x0100
#define VL_GLOBALAMBIENT 0x0200
#define VL_BACKGROUNDCOLOR 0x0300
#define VL_SHADINGMETHOD 0x0400
#define VL_SHADINGMODEL 0x0500
#define VL_LOCALVIEWER 0x0600
#define VL_COUNTCLOCKWISE 0x0700
#define VL_TWOSIDESHADE 0x0800
#define VL_DEPTHBUFFER 0x0900
#define VL_BACKFACEREMOVAL 0x0A00
#define VL_PERTURBMATERIAL 0x0B00
#define VL_PERTURBNORMAL 0x0C00
#define VL_PERTURBPIXEL 0x0D00
#define VL_PERTURBFACET 0x0E00
#define VL_ENVIRONMENT 0x0F00
#define VL_INQUIRE -1
/* projection mode */
#define VL_PROJECTIONMODE 0x03
#define VL_PERSPECTIVE 0x01
#define VL_ORTHOGONAL 0x02
/* Viewport Mapping Mode */
/*
#define VL_HORIZONTALFIT 1
#define VL_VERTICALFIT 2
#define VL_AUTOFIT 3
#define VL_VIEWPORTFIT 4
*/
/* standard pen and brush color */
#define VL_NONE 0
#define VL_RED 1
#define VL_GREEN 2
#define VL_BLUE 3
#define VL_BROWN 4
#define VL_MAGENTA 5
#define VL_CYAN 6
#define VL_WHITE 7
#define VL_GRAY 8
#define VL_LIGHTRED 9
#define VL_LIGHTGREEN 10
#define VL_LIGHTBLUE 11
#define VL_YELLOW 12
#define VL_LIGHTMAGENTA 13
#define VL_LIGHTCYAN 14
#define VL_LIGHTGRAY 15
#define VL_BLACK 16
/* shading method */
#define VL_WIREFRAME 0x0001
#define VL_SOLIDFILL 0x0002
#define VL_CONTOURSHADE 0x0004
#define VL_GOURAUDSHADE 0x0008
#define VL_PHONGSHADE 0x0010
#define VL_FLATSHADE 0x0020
/* shading model */
#define VL_PHONGMODEL 0x0100
#define VL_SPECULARMODEL 0x0200
/* mark type */
#define VL_NULLMARK 0x0000
#define VL_CIRCLEMARK 0x0001
#define VL_CROSSMARK 0x0002
#define VL_XMARK 0x0004
#define VL_TRIANGLEMARK 0x0008
#define VL_BOXMARK 0x0010
#define VL_DIAMONDMARK 0x0020
#define VL_HEXAGONMARK 0x0040
#define VL_OCTAGONMARK 0x0080
/* arrow head type */
#define VL_NULLARROW 0x0000
#define VL_OPENARROW 0X0100
#define VL_CLOSEDARROW 0X0200
/* position mark type */
#define VL_CROSSHAIR 1
#define VL_ORIGIN 2
/* solid texture flag */
#define VL_MARBLE 0x0001
#define VL_WOODGRAIN 0x0002
#define VL_GRANITE 0x0004
/* Useful Macros */
#define ABS(x) (((x)>0)?(x):-(x))
#define TRUNC(x) ((int) (x))
//#define ROUND(x) (int)((x)+0.5f)
#define FLOOR(x) (((x)>0) ? (int)(x) : -(int)(-(x)+1))
#define CEILING(x) ((x)==(int)(x)?(x):(((x)>0)?1+(int)(x):-(1+(int)(-(x)))))
#define ROUND(x) ((x)>0 ? (int)(x+0.5f) : -(int)(0.5f-x))
#define SQR(x) ((x)*(x))
#define SQR2(x,y) ((real)(SQR(x)+SQR(y)))
#define SQR3(x,y,z) ((real)(SQR(x)+SQR(y)+SQR(z)))
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#define SWAP(a,b) { a^=b; b^=a; a^=b; }
#define MIDVAL(a,b) (((a)+(b))*0.5f)
#define LERP(a,l,h) ((l)+(((h)-(l))*(a)))
#define CLAMP(v,l,h) ((v)<(l) ? (l) : (v)>(h) ? (h) : (v))
#define STEP(v,s) ((v)<(s) ? 0 : 1)
#define SIGN(x) (((x)<0) ? -1 : (x)>0 ? 1 : 0)
#define NEWLIST(type,n) (type far *)_fmalloc (sizeof (type) * (n))
#define NEWITEM(type) (type far *)_fmalloc (sizeof (type))
#define DIST2(x,y) ((real)sqrt(SQR2(x,y)))
#define DIST3(x,y,z) ((real)sqrt(SQR3(x,y,z)))
#define DETERM2(a,b,c,d) ((a)*(d)-(b)*(c))
#define DETERM3(a,b,c,d,e,f,g,h,i) ((a)*DETERM2(e,f,h,i)+(b)*DETERM2(f,d,i,g)+(c)*DETERM2(d,e,g,h))
#define VSET2(v,x,y) ((v)[0]=(real)(x),(v)[1]=(real)(y))
#define VSET3(v,x,y,z) ((v)[0]=(real)(x),(v)[1]=(real)(y),(v)[2]=(real)(z))
#define VSET4(v,x,y,z,w) ((v)[0]=(real)(x),(v)[1]=(real)(y),(v)[2]=(real)(z),(v)[3]=(real)(w))
#define VGET2(v,x,y) (x=(v)[0],y=(v)[1])
#define VGET3(v,x,y,z) (x=(v)[0],y=(v)[1],z=(v)[2])
#define VGET4(v,x,y,z,w) (x=(v)[0],y=(v)[1],z=(v)[2],w=(v)[3])
/*****************************************************************************
Function Prototypes
*****************************************************************************/
/*****************************************************************************
Basic Functions
*****************************************************************************/
BINARY InitializeVisualib (void);
VOIDED ExitVisualib (void);
VOIDED AboutVisualib (void);
VOIDED LicenseInfo (void);
/* utility functions */
BINARY MessageOn (int flag);
VOIDED ErrorMessage (LPSTR msg);
VOIDED Message (LPSTR msg);
COLORREF WINAPI SelectColor (COLORREF color);
SHORT NumViewer (void);
VOIDED SetPoint2D (LPPOINT2D point, real x, real y);
VOIDED SetPoint3D (LPPOINT3D point, real x, real y, real z);
VOIDED Se